Repository navigation
feat: 템플릿 사용 기록 API (#79) - #80
Merged
Merged
Conversation
chjpooh2002
approved these changes
Nov 12, 2026
chjpooh2002
left a comment
Contributor
There was a problem hiding this comment.
딱히 크게 수정할 부분은 없는 거 같습니다! 수고하셨습니다~~
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
관련 이슈
작업 내용
명세 14번
POST /api/v1/templates/{templateId}/usages. 클립보드 복사·삽입이 성공한 뒤 화면이 부르고, 템플릿의 최근 사용 시각(last_used_at)만 갱신합니다.TEMPLATE200_6사용 기록이 저장되었습니다.result:templateId,lastUsedAt(+09:00)DASHBOARD_COPY/POPUP_COPY/EMAIL_INLINE. 없거나 틀리면TEMPLATE400_9. 저장하지 않음TEMPLATE404_1, 내 휴지통TEMPLATE404_2(getActiveTemplate재사용)last_used_at·updated_at은Clock현재 시각,edited_at·목록 순서는 그대로UsageChannel(template/entity): 저장하지 않는 값이라 쓰는 도메인의entity에 뒀습니다. 상수 이름이 API 값입니다@ValidUsageChannel(template/annotation): 요청 필드를 열거형으로 받으면 틀린 값이 JSON 역직렬화 실패(COMMON400_1)가 되므로, 문자열로 받아 여기서 검사합니다. 대소문자·앞뒤 공백은 고쳐 주지 않습니다TemplateCommandService.recordUsage: 메서드에@Transactional(feat: 휴지통 템플릿 복구 API (#67) #69 규칙)잘못된 본문의 응답
{},"channel": null,""," ", 틀린 값, 소문자, 앞뒤 공백,"1"TEMPLATE400_91,0,true)TEMPLATE400_9(잭슨이 문자열로 바꿈)null본문,[], 채널이 배열·객체COMMON400_1(전역 처리 그대로)채널이 틀리고 템플릿도 없으면 형식 검증이 먼저라
TEMPLATE400_9입니다.테스트
TemplateUsageControllerTest(통합): 성공 응답·no-store·+09:00·필드 순서, 세 채널,last_used_at·updated_at갱신과edited_at·created_at·이름·단축어·본문 유지, 두 번 기록하면 나중 시각, 목록 순서 유지, 위 표의 잘못된 본문, 404 네 경우, 숫자가 아닌 IDCOMMON400_1, 토큰 없음COMMON401_1TemplateUsageDynamicUpdateTest: 조회 직후 별도 트랜잭션이 이름을 바꿔도 사용 기록이 되돌리지 않음.@DynamicUpdate를 빼면 이 테스트가 실패하는 것을 확인했습니다TemplateCommandServiceTest(모키토),UsageChannelTest,ValidUsageChannelTest,TemplateErrorCodeTest확인 체크리스트
./gradlew build통과global공통 코드 변경 없음리뷰어에게
markUsed로 씁니다 (@Modifying아님).@DynamicUpdate(feat: 내 템플릿 수정 API (#52) #53) 덕분에 UPDATE에는last_used_at과 감사 기능이 채우는updated_at만 들어가updated_at을 직접 넣지 않아도 되고, 기존 404 구분을 그대로 씁니다. 대신 본문 복호화에 실패하는 행은 500입니다. 이 API는 실패해도 화면이 알리지 않습니다last_used_at이 바뀝니다. 표시하지 않는 값이고 복구하면 그대로 남는 정도라 허용했습니다 (서비스 주석)updated_at도 그대로입니다. 운영 시계가 마이크로초 단위라 실제로는 거의 없습니다template_used로 보냅니다TemplateController·TemplateSuccessCode를 이어서 건드립니다🤖 Generated with Claude Code